package com.example.lanouhn.firstapp.activity.utils;

import com.alibaba.fastjson.JSON;
import com.example.lanouhn.firstapp.activity.model.CartList;
import com.example.lanouhn.firstapp.activity.model.CartListSum;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * 购物车列表的解析
 * Created by lanouhn on 16/7/26.
 */
public class CartListSumJson {
    /**
     * 购物车列表的解析
     *
     * @param json
     * @return
     */
    public static CartListSum getCartListSum(String json) {
        //创建数组来储存数据
        CartListSum list_sum = new CartListSum();
        try {
            JSONObject obj = new JSONObject(json);
            JSONObject obj1 = obj.getJSONObject("datas");




            //引包  利用fastJSON中的  来实现快速获取实体类信息
            list_sum = JSON.parseObject(obj1.toString(),CartListSum.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }
            return list_sum;
    }
}
